
import unittest

from Schedule.SingleShiftPerDayEvaluator import SingleShiftPerDayEvaluator
from Schedule.Doctors import Doctors

class SingleShiftPerDayEvaluatorTestCases(unittest.TestCase):
    def setUp(self):
        self._initCount = dict()
        for i in range(0, len (Doctors().doctorNames)):
            self._initCount[i] = 0;
    
    def tearDown(self):
        pass

    def test_May1(self):
        
        schedule = [1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 1, 4]
        
        chromosome = [0, 4, 1, 3, 5, 5, 2, 1, 4, 3, 0, 2, 0, 2, 1, 3, 1, 1, 5, 2, 3, 1, 4, 0, 0, 1, 4, 2, 4, 2, 4, 5, 2, 4, 0, 3, 3, 1, 4, 5, 3, 0, 1, 1, 1, 4, 2, 1, 3, 5, 5, 3, 3, 2, 1, 3, 4, 1, 3, 1, 0, 5, 5, 2, 0, 4, 0, 1, 3, 2, 0, 3, 1, 5, 4, 2, 2, 3, 0, 5, 2, 1]
        
        score = SingleShiftPerDayEvaluator(schedule, self._initCount, 1).evaluate(chromosome)

        self.assertEquals(score, 26)
        
    def test_MayMaximumScore(self):
        
        schedule = [1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 1, 4]
        
        chromosome = []
        
        for x in schedule:
            for y in range(x):
                chromosome.append(y)
                
        score = SingleShiftPerDayEvaluator(schedule, self._initCount, 1).evaluate(chromosome)

        self.assertEquals(score, 31)
        
    def test_MayMinimumScore(self):
        
        schedule = [1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 4, 4, 3, 3, 3, 1, 1, 1, 4]
        
        chromosome = []
        
        for x in schedule:
            for y in range(x):
                chromosome.append(1)
                
        score = SingleShiftPerDayEvaluator(schedule, self._initCount, 1).evaluate(chromosome)
        
        self.assertEquals(score, 10)
        

if __name__ == '__main__':
    unittest.main()
    